﻿

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <link href="~/css/framework-font.css" rel="stylesheet" />
    <link href="~/css/framework-theme.css" rel="stylesheet" />
    <script src="~/lib/jquery/1.12.4/jquery.min.js"></script>
    <script src="~/lib/bootstrap/3.3.4/js/bootstrap.min.js"></script>
    <link href="~/lib/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/lib/wdtree/tree.js"></script>
    <link href="~/lib/wdtree/tree.css" rel="stylesheet" />
    <link href="~/lib/select2/select2.min.css" rel="stylesheet" />
    <script src="~/lib/select2/select2.min.js"></script>
    <script src="~/lib/laydate/laydate.js"></script>
    <script src="~/lib/moment/moment.js"></script>
    <link href="~/lib/wizard/wizard.css" rel="stylesheet" />
    <script src="~/lib/wizard/wizard.js"></script>
    <script src="~/lib/validate/jquery.validate.min.js"></script>
    <script src="~/lib/datepicker/WdatePicker.js"></script>
    <script src="~/lib/jqgrid/5.3.0/i18n/grid.locale-cn.js"></script>
    <link href="~/css/framework-ui.css" rel="stylesheet" />
    <script src="~/js/framework-ui.js"></script>
</head>
<body>
    <form id="form1">
        <div style="padding-top: 20px; margin-right: 20px;">
            <table class="form">
                <tr>
                    <th class="formTitle">微信号</th>
                    <td class="formValue">
                        <input id="WeChat" name="WeChat" type="text" class="form-control required" placeholder="请输入微信号" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">公众号名称</th>
                    <td class="formValue">
                        <input id="AppName" name="AppName" type="text" class="form-control required" placeholder="请输入公众号名称" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">AppId</th>
                    <td class="formValue">
                        <input id="AppId" name="AppId" type="text" class="form-control required" placeholder="请输入公众号AppId" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">AppSecret</th>
                    <td class="formValue">
                        <input id="AppSecret" name="AppSecret" type="text" class="form-control required" placeholder="请输入公众号AppSecret" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle" style="height: 35px;">Token</th>
                    <td class="formValue">
                        <input id="Token" name="Token" type="text" class="form-control required" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">公众号类型</th>
                    <td class="formValue">
                        <select id="AppType" name="AppType" class="form-control required">
                            <option value="">--请选择--</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">启用标记</th>
                    <td class="formValue">
                        <select id="EnabledMark" name="EnabledMark" class="form-control required">
                            <option value="true">是</option>
                            <option value="false">否</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle" valign="top" style="padding-top: 5px;">
                        备注
                    </th>
                    <td class="formValue">
                        <textarea id="Description" name="Description" class="form-control" style="height: 60px;"></textarea>
                    </td>
                </tr>
            </table>
        </div>
    </form>
    <script>
        var keyValue = $.request("keyValue");
        $(function () {
            initControl();
            if (!!keyValue) {
                $.ajax({
                    url: "/WeixinManage/WxAccount/GetFormJson",
                    data: { keyValue: keyValue },
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        $("#form1").formSerialize(data);
                        $("#form1").find('div.ckbox label').attr('for', '');
                        $("#form1").find('.form-control,input').attr('readonly', 'readonly');
                        $("#form1").find('select').attr('disabled', 'disabled');
                    }
                });
            }
        });
        function initControl() {
            $("#AppType").bindSelect({
                url: "/SystemManage/DictItem/GetSelectJson",
                param: { enCode: "WxAppType" }
            });
            $("#EnabledMark").bindSelect();
        }
        function submitForm() {
            if (!$('#form1').formValid()) {
                return false;
            }
            $.submitForm({
                url: "/WeixinManage/WxAccount/SubmitForm?keyValue=" + keyValue,
                param: $("#form1").formSerialize(),
                success: function () {
                    $.currentWindow().$("#gridList").trigger("reloadGrid");
                }
            })
        }
    </script>
</body>
</html>
